<!-- 添加标签 -->
<template>
	<view class='cu-modal' :class='{show: show}'>
		<view class='modal'>
			<view class='alert-title'>{{params.title}}</view>
			<view class='alert-content'>{{params.content}}</view>
			<view class='alert-btn' @click='handleConfirm'>{{params.btnText}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				params: {},
			}
		},
		methods: {
			open(params) {
				this.params.title = params.title || '提示';
				this.params.content = params.content || '';
				this.params.btnText = params.btnText || '确认';
				this.params.success = params.success || null;
				this.show = true;
			},
			close() {
				this.open = false;
			},
			handleConfirm() {
				if(this.params.success) {
					this.params.success()
				}
				this.close()
			}
		}
	}
</script>

<style scoped lang="scss">
	.modal {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
		width: 638rpx;
		border-radius: 6rpx;
		background: #FFFFFF;
		text-align: left;
		padding: 68rpx 0 62rpx 0;
		
		.alert-title {
			font-size: 32rpx;
			font-weight: 500;
			color: #3D3D3D;
			text-align: center;
		}
		
		.alert-content {
			font-size: 28rpx;
			color: #999999;
			margin-top: 20rpx;
			text-align: center;
		}
		
		.alert-btn {
			width: 490rpx;
			height: 80rpx;
			margin: 86rpx auto 0 auto;
			border-radius: 8rpx;
			background: var(--primaryGradBg);
			font-size: 28rpx;
			font-weight: 500;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
</style>